import FormList from '@/components/FormList'
import FormButtonRow from '@/components/FormList/FormItems/FormButtonRow'
import styles from './index.module.less'
import type { FormListType } from '@/form'

const FormListUI = () => {

  const formList: FormListType = [
    {
      type: 'input',
      name: 'username',
      label: '用户名',
      formItemProps: {
        rules: [
          {
            required: true,
            message: '请输入用户名'
          }
        ],
        tooltip: {
          message: '请输入用户名'
        }
      },
      formFieldProps: {
        placeholder: '请输入用户名'
      }
    },
    {
      type: 'input',
      name: 'password',
      label: '密码',
      formItemProps: {
        rules: [
          {
            required: true,
            message: '请输入密码'
          }
        ]
      },
      formFieldProps: {
        placeholder: '请输入密码'
      }
    }
  ]

  return <div className={styles.FormListUI}>
    <FormList
      formList={formList}
      footer={<FormButtonRow type='normal' />}
      onSubmit={console.log}
    />
  </div>
}

export default FormListUI
